package course;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import people.Person;
import people.professor.Professor;
import people.student.Student;
import permission.role.TutorRole;
import course.AbstractCourseType;
import course.Course;

/**
 * @author Andreas Waldherr (e1028787@student.tuwien.ac.at)
 *
 */
public class FinalExamCourseType extends AbstractCourseType{

	private String examData = "";
	
	public FinalExamCourseType(String courseID, String courseName, Professor courseLeader, Date registerStart, Date registerEnd, Date unregisterEnd) {
		super(courseID, courseName, courseLeader, registerStart, registerEnd, unregisterEnd);
	}
	
	public void setExamData(String examData){
		this.examData = examData;
	}
	
	public String getExamData(){
		return this.examData;
	}
	
	@Override
	public String getGrade(int value) {
		String note = "nicht bestanden";
		
		if(value > 50)
			note = "bestanden";
		
		return "your grading: "+note;
	}

	@Override
	public List<String> registrationOptions(Student s) {
		List<String> options = new ArrayList<String>();
		options.add("You are automatically registered for the final exam: "+getExamData());
		return options;
	}

	@Override
	public boolean finalizeRegistration(Student s, int index) {
		// we dont need an extra set for student cause we can just take them from the course as everybody has to do this exam.
		return true;
	}

	@Override
	public boolean isStudentRegistered(Student s) {
		boolean registered = false;
		
		if(getCourse().getRegisteredStudents(getCourseLeader()).contains(s)){
			registered = true;
		}
		
		return registered;
	}

	@Override
	public String getInformationForStudent(Student s) {
		String ret = "nicht angemeldet";
		if(isStudentRegistered(s))
			ret = "ist angemeldet";
		return ret;
	}
}